﻿#region ... Copyright Notice ...
/*
   Copyright 2008 Tyler Jensen

	Author: Tyler Jensen    http://www.tsjensen.com/blog

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Net;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace Atrax.Library
{
	[DataContract, Serializable]
	public class InternetResponse
	{
		List<string> redirects = new List<string>();
		WebHeaderCollection headers = new WebHeaderCollection();

		/// <summary>
		/// The original request that generated this response in the spider.
		/// </summary>
		[DataMember]
		public InternetRequest Request { get; set; }

		/// <summary>
		/// The spider request ID used to coordinate response data on the master in the ProcessResponse method of the query processor.
		/// </summary>
		[DataMember]
		public string SpiderQueryId { get; set; }

		/// <summary>
		/// The response data content type.
		/// </summary>
		[DataMember]
		public string ContentType { get; set; }

		/// <summary>
		/// The URLs the request was redirected to.
		/// </summary>
		[DataMember]
		public List<string> Redirects { get { return redirects; } set { redirects = value; } }

		/// <summary>
		/// The response headers.
		/// </summary>
		[DataMember]
		public WebHeaderCollection Headers { get { return headers; } set { headers = value; } }

		/// <summary>
		/// The body of the response in original byte array.
		/// </summary>
		[DataMember]
		public byte[] Body { get; set; }

		/// <summary>
		/// The HTTP protocol version returned by the request.
		/// </summary>
		[DataMember]
		public string ProtocolVersion { get; set; }

		/// <summary>
		/// The HTTP status code returned by the request.
		/// </summary>
		[DataMember]
		public string StatusCode { get; set; }

		/// <summary>
		/// The HTTP status description returned by the request.
		/// </summary>
		[DataMember]
		public string StatusDescription { get; set; }
	}
}
